﻿/*
 * Time Temple - Kirston
 * Twilight of the Gods
 */
var maxNum = 10;  
var minNum = 1;  
var n = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
var a1 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
var a2 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
var a3 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
var a4 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
var a5 = Math.floor(Math.random() * (5 - 0 + 1)) + 0;  
var a6 = Math.floor(Math.random() * (5 - 0 + 1)) + 0;  
var a7 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
var a8 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
var a9 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
var a10 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
var a11 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
var a12 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  



var itemList = Array(
4009345,4009346,4009347,4009348,4009349,4009350,4009351,4009352,4009353,4009354,4009355,4009356);
var 亂數 = Array(
a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);


function start() {
var id =cm.getPlayer().getId();
      if (cm.MissionStatus(id,5278,0,4)==false) {
cm.MissionMake(id,5278,0,0,0,0);
}  
cm.MissionFinish(id,5278);
    cm.sendOk("任務評級:【C級】\r\n獎勵進行結算");


}

function action(mode, type, selection) {
    //if (mode == 1) {
		if (cm.getMapId() == 970072300 ){
        var text = "";
		for(var i=0; i<itemList.length; i++) {
			text+="#i"+itemList[i]+"##z"+itemList[i]+"##l"+亂數[i]+"個\r\n";
		}
		for(var i=0; i<itemList.length; i++) {
                  cm.gainItem(itemList[i],亂數[i]);
		}


 cm.sendOk("恭喜你獲得了\r\n"+text);
cm.dispose();
	} else {

cm.dispose();
		
	}

    //}
    cm.dispose();

// If accepted, = summon PB + Kriston Disappear + 1 hour timer
// If deny = NoTHING HAPPEN
}
